#include <stdio.h>
#include <stdlib.h>


void selectshort(int nums[] ,int n)
{
    int i ,k ,temp;
    for(i=0; i<n-1; i++)
    {
        int j;
        k = i;
        for(j=i+1; j<n; j++)
        {
            if(nums[j] < nums[k])
            {
                k = j;
            }
        }
        temp = nums[i];
        nums[i] = nums[k];
        nums[k] = temp;
    }
}




int main()
{
    //int n = 8;
    int arr[] = {2,3,1,5,4,8,2,4};
    int n = sizeof(arr)/4;
    int i = 0;
    for(i=0; i<n; i++)
    {
        printf("arr[%d]=%d\n",i,arr[i]);
    }
    printf("arr nums = %d",n);
    selectshort(arr, n);
    for(i=0; i<n; i++)
    {
        printf("arr[%d]=%d\n",i,arr[i]);
    }


}